from django.db import models
from apps.api.interface.models import InterfaceModel
from utils.base_model import BaseModel


class ConfigModel(BaseModel):

    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50, verbose_name="该名称", help_text="公共配置名称")
    content = models.TextField(verbose_name="公共配置内容", help_text="公共配置内容", blank=True)
    interface = models.ForeignKey(to=InterfaceModel, on_delete=models.CASCADE, verbose_name="所属接口id",
                                  help_text="所属接口id", related_name="config")
    is_delete = models.IntegerField(verbose_name="逻辑删除(0-未删除、1-删除)", help_text="逻辑删除(0-未删除、1-删除)",
                                    default=0)

    class Meta:
        db_table = "dtp_config"
        verbose_name = "公共配置"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
